package com.check.checksamejourney.mapper;

import com.check.checksamejourney.bean.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

public interface UserMapper {

    @Select("select token from user where is_deleted = 0 and wxapp_open_id = #{wxappOpenId} ")
    String getTokenByWxappOpenId(String wxappOpenId);

    @Select("select id from user where is_deleted = 0 and token = #{user} ")
    Long getUserIdByToken(String token);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into user(wxapp_open_id,token,create_time,update_time) values(#{wxappOpenId},#{token},now(),now())")
    int insetUser(User user);

}
